package com.kaoshi.myweb.webstruts.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.kaoshi.myweb.webstruts.model.UserModel;
import com.kaoshi.myweb.webstruts.service.UserService;
import com.opensymphony.xwork2.ActionSupport;

@Component
public class SSHAction extends ActionSupport {
	
	private UserModel user;
	
	@Autowired
	private UserService userService;
	
	
	public String reg() {
		return SUCCESS;
	}
	
	public String save() {
		if(user != null)
			userService.saveUser(user);
		
		return SUCCESS;
	}
	
	public UserModel getUser() {
		return user;
	}

	public void setUser(UserModel user) {
		this.user = user;
	}
	
}
